package com.atcd.security_redis_jwt.controller;


import com.atcd.security_redis_jwt.bean.User;
import com.atcd.security_redis_jwt.service.LoginService;
import com.atcd.security_redis_jwt.service.impl.LoginServiceImpl;
import com.atcd.security_redis_jwt.util.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class LoginController {

    @Autowired
    private LoginService loginService;



    @PostMapping("/user/login")
    public ResponseResult login(User user){

        //登录
        return loginService.login(user);
    }


    @GetMapping("/user/logout")
    public ResponseResult logout(){

      return loginService.logout();
    }
}